{% extends "base.html" %}

{% block title %}查看学生{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h2 class="mb-4">学生详情</h2>
            <div class="card mb-4">
                <div class="card-body">
                    <h5 class="card-title">基本信息</h5>
                    <div class="row">
                        <div class="col-md-4">
                            <p><strong>姓名：</strong>{{ student.name }}</p>
                            <p><strong>性别：</strong>{{ student.gender }}</p>
                            <p><strong>出生日期：</strong>{{ student.birth_date }}</p>
                        </div>
                        <div class="col-md-4">
                            <p><strong>身份证号：</strong>{{ student.id_card }}</p>
                            <p><strong>家庭住址：</strong>{{ student.address }}</p>
                        </div>
                        <div class="col-md-4">
                            <p><strong>家长姓名：</strong>{{ student.parent_name }}</p>
                            <p><strong>联系电话：</strong>{{ student.phone }}</p>
                            <p><strong>家长关系：</strong>{{ student.parent_relation }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="mb-3">注册记录</h3>
            <div class="table-responsive mb-4">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>年级</th>
                            <th>年度</th>
                            <th>学期</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for registration in registrations %}
                        <tr>
                            <td>{{ registration.grade }}</td>
                            <td>{{ registration.year }}</td>
                            <td>{{ registration.semester }}</td>
                            <td>
                                <a href="{{ url_for('view_class', id=registration.class_id) }}" class="btn btn-sm btn-info">查看班级</a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <h3 class="mb-3">收费记录</h3>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>日期</th>
                            <th>班级</th>
                            <th>收费项目</th>
                            <th>金额</th>
                            <th>收款账号</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for payment in payments %}
                        <tr>
                            <td>{{ payment.date.strftime('%Y-%m-%d') }}</td>
                            <td>{{ payment.class_name }}</td>
                            <td>{{ payment.project }}</td>
                            <td>{{ "%.2f"|format(payment.amount) }}</td>
                            <td>{{ payment.account }}</td>
                            <td>
                                <a href="{{ url_for('view_payment', id=payment.id) }}" class="btn btn-sm btn-info">查看</a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <div class="mt-3">
                <a href="{{ url_for('list_students') }}" class="btn btn-secondary">返回列表</a>
            </div>
        </div>
    </div>
</div>
{% endblock %} 